home *** CD-ROM | disk | FTP | other *** search
- #ifndef __CTick_h__
- #define __CTick_h__
-
- #include <QuickDraw.h>
- #include <QDOffscreen.h>
- #include <deque.h>
-
- /////////////////////////////////////////////////////////////////////////////
- //
- // Forward
- //
-
- class CTickerControl;
- class CTickerError;
-
- /////////////////////////////////////////////////////////////////////////////
- //
- // Macros & constants
- //
-
- const short MAX_STR_NAME_LENGTH = 254; // because we use Str255s
- const short MAX_STR_VALUE_LENGTH = 254; // because we use Str255s
- const short NULLTERM = 1; // tack this on for null termination
-
- const char UNINITIALIZED_TICK_NAME[] = "";
- const char UNINITIALIZED_TICK_VALUE[] = "";
-
- typedef enum tagRenderState
- {
- renderON,
- renderOFF
- } RenderState;
-
- /////////////////////////////////////////////////////////////////////////////
- //
- // CTick class definition
- //
-
- class CTick
- {
- public:
- CTick();
- CTick( CTickerControl* pControl, long id ) ;
- virtual ~CTick() ;
-
- friend CTickerError;
-
- public:
- void Render(RenderState renderState);
- void EraseImage(void);
- BitMap * GetBitMap(void);
- void ReleaseBitMap(void);
- char * SetName(char * name);
- char * SetValue(char * value);
- char * GetName(void) { return mStrName; }
- char * GetValue(void) { return mStrValue; }
- short HSize(void) { return mSize.h; }
- short VSize(void) { return mSize.v; }
- void SetX(short x) { mXLocation = x; }
- void BumpX(short x) { mXLocation += x; }
- short GetX(void) { return mXLocation; }
- void SetIsCached(Boolean isCached) { mCached = isCached; }
- Boolean GetIsCached(void) { return mCached; }
- void TruncateValue(short numberOfCharacters = 1);
-
- protected:
- void SetFontParams(void);
- void SaveFontParams(void);
- void ResetFontParams(void);
- void GetTextSize(const StringPtr string, Point * textSize);
- void InitFontInfo(void);
-
- protected:
- char * mStrName; // stock label buffer
- char * mStrValue; // stock values buffer
- CTickerControl* mControl; // the CTickerControl we're associated with
- FontInfo * mFontInfo; // font characterstics, for drawing
- Rect mBoundsRect; // bounds of offscreen world
- GWorldPtr mGWorld; // offscreen world
- PixMapHandle mPixMap; // pixmap of offscreen world
- Point mSize; // size of the (offscreen) world
- long mDataItemID; // an index
- short mXLocation; // coordinate; to the left of this is visible
- Boolean mCached; // is this one cached?
- RenderState mRenderState; // are we currenty rendered?
- };
-
- /////////////////////////////////////////////////////////////////////////////
-
- #endif // __CTick_h__